package threadTest.example;

import createModel.prototypeModel.User;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * 功能描述:用户生产者
 * 2024/08/29
 *
 * @author ZhangYi
 */
public class UserProducer {

	private UserContatiner userContatiner;

	private List<User> users;

	public UserProducer(UserContatiner userContatiner) {
		this.userContatiner = userContatiner;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	public void produce() throws InterruptedException {
		if (CollectionUtils.isEmpty(this.users)){
			return;
		}
		this.userContatiner.producer(this.users);
	}
}
